home *** CD-ROM | disk | FTP | other *** search
- unit Unit2;
- interface
- uses
- SysUtils, WinTypes, WinProcs, Messages, Classes, Graphics, Controls,
- Forms, Dialogs, StdCtrls, Buttons, DB, DBTables, Iaconn, Iabuttns,
- DBCtrls, Iacsdb, Grids, DBGrids, ExtCtrls;
- {
- This quick demo shows how to use the TIADBComboBox.
-
- This Demo uses the "DBDemos" alias to get to the Animals.db
-
- The reason I created this component was becuase I didn't want to set up
- another Database file just to hold a few possible choices, but I didn't
- want to hard code the possible choices, for this field, either.
- I also wanted to be able to add to list at run time.
- }
- type
- TForm2 = class(TForm)
- IADBComboBox1: TIADBComboBox;
- IASRBitBtn1: TIASRBitBtn;
- IASRBitBtn2: TIASRBitBtn;
- IASource1: TIASource;
- CheckBox1: TCheckBox;
- Table1: TTable;
- DataSource1: TDataSource;
- DBGrid1: TDBGrid;
- DBNavigator1: TDBNavigator;
- Button1: TButton;
- procedure FormCreate(Sender: TObject);
- procedure BitBtn1Click(Sender: TObject);
- procedure CheckBox1Click(Sender: TObject);
- procedure Button1Click(Sender: TObject);
- private
- { Private declarations }
- public
- { Public declarations }
- end;
-
- var
- Form2: TForm2;
-
- implementation
-
- {$R *.DFM}
-
- procedure TForm2.FormCreate(Sender: TObject);
- begin
- {Point the filename porperty to the right directory,
- If you do not specify a directory the INI file will be created in the
- \Windows directory}
- IASource1.FileName = ExtractFilePath(Application.ExeName) + IASource1.FileName;
- {Get the INI values from the file, for all the connected components}
- IASource1.UpdateControls;
- {Set the KeepHistory property with the value of the checkbox. When Keep
- history is true all the values entered into the combobox are stored in
- the list.}
- IADBComboBox1.KeepHistory:=CheckBox1.Checked;
- end;
-
- procedure TForm2.BitBtn1Click(Sender: TObject);
- begin
- Close;
- end;
-
- procedure TForm2.CheckBox1Click(Sender: TObject);
- begin
- IADBComboBox1.KeepHistory:=CheckBox1.Checked;
- end;
-
- procedure TForm2.Button1Click(Sender: TObject);
- begin
- IADBComboBox1.Items.Clear;
- end;
-
- end.
-